#pragma once

#include "CoreCommon.h"
#include "MathCommon.h"

LOCO_BEGIN

/// This struct is a POD
struct LOCO_CORE_API Vector2
{
	// Attributes
	float x, y;

	// Static constants
	static const Vector2 zero;
	static const Vector2 unit_x;
	static const Vector2 unit_y;
	static const Vector2 one;

	// Methods
	Vector2() = default;
	Vector2(Vector2 const& in) = default;
	Vector2(float x_val, float y_val);
	Vector2(float value);

	Vector2 operator-() const;
	Vector2 operator+(Vector2 const& in) const;
	Vector2 operator-(Vector2 const& in) const;
	Vector2 operator*(Vector2 const& in) const;
	Vector2 operator/(Vector2 const& in) const;

	Vector2& operator+=(Vector2 const& in);
	Vector2& operator-=(Vector2 const& in);
	Vector2& operator*=(Vector2 const& in);
	Vector2& operator/=(Vector2 const& in);

	bool operator==(Vector2 const& in) const;
	bool operator!=(Vector2 const& in) const;
	bool operator>(Vector2 const& in) const;
	bool operator<(Vector2 const& in) const;
	bool operator>=(Vector2 const& in) const;
	bool operator<=(Vector2 const& in) const;

	float norm() const;
	float square_norm() const;
	Vector2 normalize() const;

	static bool near_equal(Vector2 const& a, Vector2 const& b, float delta = DELTA);
	static float distance(Vector2 const& a, Vector2 const& b);
	static float square_distance(Vector2 const& a, Vector2 const& b);
	static float dot(Vector2 const& a, Vector2 const& b);
	static Vector2 reflection(Vector2 const& in, Vector2 const& normal);
	static Vector2 lerp(Vector2 const& a, Vector2 const& b, float value);
	static Vector2 lerp(Vector2 const& a, Vector2 const& b, Vector2 const& value);
};

// inline defintions
#include "Vector2.inl"

LOCO_END

